-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support loading ICU data from managed Interop #49406
Conversation
In iOS we support loading a custom dat file when working with ICU. The way this worked originally was the mono runtime exported a function that native code would call into (similar to wasm). After thinking about it a bit, it makes more sense to load this the same way we do on desktop, but with the ability to provide the path to an ICU dat file via an AppContext key `ICU_DAT_FILE_PATH`. This can be provided before Xamarin iOS calls `monovm_initialize` and they won't have to worry about calling some special function.
Tagging subscribers to this area: @tarekgh, @safern Issue DetailsIn iOS we support loading a custom dat file when working with ICU. The way this worked originally was the mono runtime exported a function that native code would call into (similar to wasm). After thinking about it a bit, it makes more sense to load ICU the same way we do on desktop, but with the ability to provide the path to an ICU dat file via an AppContext key
|
How we'll guarantee the loaded data file will be compatible with the loaded ICU code library? I am guessing we can run into some issues that will be hard to diagnose if the data is not compatible with the code library. |
For iOS, we'll control the version that we're using and the data file that comes with it. Beyond that, good question. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for hitting you with a bunch of style nits again.
Otherwise looks fine to me, thanks!
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.LoadICU.Unix.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.LoadICU.iOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs
Outdated
Show resolved
Hide resolved
|
||
return load_icu_data (icu_data); | ||
if (load_icu_data(icu_data) == 0) { | ||
fprintf(stderr, "ICU BAD EXIT %d.", ret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fprintf [](start = 8, length = 7)
should we do log_icu_error instead in all places writing to the stderr?
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.LoadICU.Unix.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some minor comments. LGTM otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
monovm_ bits lgtm
#ifndef INVARIANT_GLOBALIZATION | ||
icu_dat_path, | ||
icu_dat_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: trailing commas are not an error.
(and they play nicer with git history when someone adds the next array entry)
Mono windows test failures are unrelated #49569 |
In iOS we support loading a custom dat file when working with ICU. The way this worked originally was the mono runtime exported a function that native code would call into (similar to wasm). After thinking about it a bit, it makes more sense to load ICU the same way we do on desktop, but with the ability to provide the path to an ICU dat file via an AppContext key
ICU_DAT_FILE_PATH
. The key can be provided before Xamarin iOS callsmonovm_initialize
and they won't have to worry about calling some special function.